<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="{lang.LANG_SMALL_NAME}" xml:lang="{lang.LANG_SMALL_NAME}">
<head>
<title>{lang.KLEEJA_CP} - {config.sitename}</title>
<!-- top-head -->
<meta http-equiv="Content-Language" content="{lang.LANG_SMALL_NAME}" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<link rel="shortcut icon" href="{STYLE_PATH_ADMIN}images/favicon.ico" />
<link rel="icon" type="image/gif" href="{STYLE_PATH_ADMIN}images/favicon.gif" />

<link rel="stylesheet" type="text/css" media="screen" href="{STYLE_PATH_ADMIN}css/global.css" />
<link rel="stylesheet" type="text/css" media="screen" href="{STYLE_PATH_ADMIN}css/byname.css" />
<link rel="stylesheet" type="text/css" media="screen" href="{STYLE_PATH_ADMIN}js/fancybox/jqueryfb.css" />
<link rel="stylesheet" type="text/css" media="screen" href="{STYLE_PATH_ADMIN}js/tipsy/tipsy.css" />
<IF NAME="{lang.DIR}==rtl"><link rel="stylesheet" type="text/css" media="screen" href="{STYLE_PATH_ADMIN}css/rtl.css" /></IF>	
<IS_BROWSER="ie6"><link rel="stylesheet" type="text/css" media="screen" href="{STYLE_PATH_ADMIN}css/ie6.css" /></IS_BROWSER>
<IS_BROWSER="ie"><link rel="stylesheet" type="text/css" media="screen" href="{STYLE_PATH_ADMIN}css/ie.css" /></IS_BROWSER>

<script type="text/javascript">
<!--//
var STYLE_PATH_ADMIN = '{STYLE_PATH_ADMIN}';
var go_to = '{go_to}';
//-->
</script>
<script type="text/javascript" src="{STYLE_PATH_ADMIN}js/jquery.min.js"></script>
<!--script type="text/javascript" src="{STYLE_PATH_ADMIN}js/jquery.ui.min.js"></script-->
<script type="text/javascript" src="{STYLE_PATH_ADMIN}js/fancybox/fancybox.js"></script>
<script type="text/javascript" src="{STYLE_PATH_ADMIN}js/tipsy/tipsy.js"></script>
<script type="text/javascript">
<!--//
jQuery(document).ready(function($){

	$('a[title]').tipsy({gravity: $.fn.tipsy.autoNS});

	//for # in address bar
	hash = window.location.hash.replace('#!', '');
	where_are_we = hash.match(/cp\=([0-9a-z_]+)/);
	if(!where_are_we)
	{
		where_are_we = 'index';
	}
	else
	{
		where_are_we = where_are_we[1];
	}

	console.debug('where_are_we='+where_are_we);
	//for go menu
	div_id = $('div[goto='+ where_are_we +']').attr('id');
	gomenu_id = $("div[goto='"+ where_are_we +"']").attr('gomenu_id').trim();
	console.debug('div_id='+div_id);
	console.debug('gomenu_id='+gomenu_id);


	//if(hash != '')
	//{
		//alert(hash)
		get_kleeja_link('./?' + hash, '#content', {'current_id':div_id, 'current_class':'link_current_thumbnail', 'gomenu_id':gomenu_id});
	//}
});

function get_kleeja_link(URL, ID, p)
{
	if(!p)
	{
		p = {};
	}

	if(!ID)
	{
		ID = '#content';
	}

	$("#sign_ajax_error").css('display', 'none');

	if(p['confirm'])
	{
		if(!confirm_from())
		{
			return;
		}
	}

	//$(ID).css('display', 'none');
	$(ID).addClass('show_less');
	
	if(URL.indexOf('?') == -1)
	{
		URL += '?';
	}
	
	window.location.hash = '!' + URL.replace('&amp;', '&').split('?', 2)[1];
	if(window.location.hash.indexOf('formkey') != -1)
	{
		window.location.hash = window.location.hash.replace(/&formkey=[a-z0-9]+/, '');
	}

	$("#sign_ajax").show();

	$.ajax({
		url: URL.replace('&amp;', '&') + '&_ajax_=1',
		cache: false,
		dataType: 'json',
		success: function(R){
			
			$("#sign_ajax").css('display', 'none');

			//not login 
			if(R.code == 999)
			{
				location.href = './';
			}
			else if(R.code == 888)
			{
				alert(R.content);
				get_kleeja_link(URL, ID);
				return;
			}
			else
			{
				$(ID).html(R.content);
				
				if(p['current_id'])
				{
					$('.' + p['current_class']).removeClass(p['current_class']);
					$('#' + p['current_id']).addClass(p['current_class']);
				}
				
				$(ID).removeClass('show_less');
				$(ID).fadeIn(100);

				if($('body').scrollTop() > 0 && $('body').scrollTop() > 200)
				{
					$('body').animate({scrollTop:0}, 'slow');
				}
				else if($('html').scrollTop() > 0 && $('html').scrollTop() > 230)
				{
					$('html').animate({scrollTop:0}, 'slow');
				}

				
				if(p['gomenu_id'])
				{
					$('.go_menu').html('').fadeOut("slow")
					if(R.menu)
					{
						$('#gomenu'+p['gomenu_id']).html(R.menu).fadeIn("slow");
					}
				}
				else
				{
					if(R.menu)
					{
						$("div[class='link_current_thumbnail']").html(R.menu).fadeIn("slow");
					}
				}
			}
		},
		error : function(R){
			//$(ID).html('----');
			$("#sign_ajax").css('display', 'none');
			$("#sign_ajax_error").show();
		}
	});
}

function submit_kleeja_data(FORM_ID, ID, CONFIRM)
{
	if(!ID)
	{
		ID = '#content';
	}

	if(CONFIRM)
	{
		if(!confirm_from())
		{
			return;
		}
	}
	
	URL = $(FORM_ID).attr('action');
	if(URL.indexOf('?') == -1)
	{
		URL += '?';
	}
	window.location.hash = '!' + URL.replace('&amp;', '&').split('?', 2)[1];
	if(window.location.hash.indexOf('formkey') != -1)
	{
		window.location.hash = window.location.hash.replace(/&formkey=[a-z0-9]+/, '');
	}

	$("#sign_ajax_error").css('display', 'none');
	//$(ID).css('display', 'none');
	$(ID).addClass('show_less');
	$("#sign_ajax").show();
	
	$.ajax({
		type: 'POST',
		url: URL.replace('&amp;', '&') + '&_ajax_=1',
		data: $(FORM_ID).serialize(),
		cache: false,
		dataType: 'json',
		success: function(R){
			
			$("#sign_ajax").css('display', 'none');
			
			//not login 
			if(R.code == 999)
			{
				location.href = './';
			}
			else if(R.code == 888)
			{
				if(R.content != ''){
					alert(R.content);
				}
				get_kleeja_link($(FORM_ID).attr('action'), ID);
				return;
			}
			else
			{
				$(ID).html(R.content);
				$(ID).removeClass('show_less');
				$(ID).fadeIn(100);
				if($('body').scrollTop() > 0 && $('body').scrollTop() > 200)
				{
					$('body').animate({scrollTop:0}, 'slow');
				}
				else if($('html').scrollTop() > 0 && $('html').scrollTop() > 230)
				{
					$('html').animate({scrollTop:0}, 'slow');
				}
				
				if(p['gomenu_id'])
				{
					$('.go_menu').html('').fadeOut("slow")
					if(R.menu)
					{
						$('#gomenu'+p['gomenu_id']).html(R.menu).fadeIn("slow");
					}
				}
				else
				{
					if(R.menu)
					{
						$("div[class='link_current_thumbnail']").html(R.menu).fadeIn("slow");
					}
				}
			}
		},
		error : function(R){
			//$(ID).html('----');
			$("#sign_ajax").css('display', 'none');
			$("#sign_ajax_error").show();
		}
	});
}

function change_color(obj, id, c, c2) {
    c = (c == null) ? 'ored' : c;
    c2 = (c == null) ? 'osilver' : c2;
    var ii = document.getElementById(id);
    if (obj.checked) {
        ii.setAttribute("class", c);
        ii.setAttribute("className", c)
    } else {
        ii.setAttribute("class", c2);
        ii.setAttribute("className", c2)
    }
}
function checkAll(form, id, _do_c_, c, c2) {
    for (var i = 0; i < form.elements.length; i++) {
        if (form.elements[i].getAttribute("rel") != id) continue;
        if (form.elements[i].checked) {
            uncheckAll(form, id, _do_c_, c, c2);
            break
        }
        form.elements[i].checked = true;
        change_color(form.elements[i], _do_c_ + '[' + form.elements[i].value + ']', c, c2)
    }
}
function uncheckAll(form, id, _do_c_, c, c2) {
    for (var i = 0; i < form.elements.length; i++) {
        if (form.elements[i].getAttribute("rel") != id) continue;
        form.elements[i].checked = false;
        change_color(form.elements[i], _do_c_ + '[' + form.elements[i].value + ']', c, c2)
    }
}
function change_color_exts(id) {
    eval('var ii = document.getElementById("su[' + id + ']");');
    eval('var g_obj = document.getElementById("gal_' + id + '");');
    eval('var u_obj = document.getElementById("ual_' + id + '");');
    if (g_obj.checked && u_obj.checked) {
        ii.setAttribute("class", 'o_all');
        ii.setAttribute("className", 'o_all')
    } else if (g_obj.checked) {
        ii.setAttribute("class", 'o_g');
        ii.setAttribute("className", 'o_g')
    } else if (u_obj.checked) {
        ii.setAttribute("class", 'o_u');
        ii.setAttribute("className", 'o_u')
    } else {
        ii.setAttribute("class", '');
        ii.setAttribute("className", '')
    }
}
function checkAll_exts(form, id, _do_c_) {
    for (var i = 0; i < form.elements.length; i++) {
        if (form.elements[i].getAttribute("rel") != id) continue;
        if (form.elements[i].checked) {
            uncheckAll_exts(form, id, _do_c_);
            break
        }
        form.elements[i].checked = true;
        change_color_exts(form.elements[i].value)
    }
}
function uncheckAll_exts(form, id, _do_c_) {
    for (var i = 0; i < form.elements.length; i++) {
        if (form.elements[i].getAttribute("rel") != id) continue;
        form.elements[i].checked = false;
        change_color_exts(form.elements[i].value)
    }
}
//-->
</script>
</head>
<body>

<!-- ajax loading sign -->
<div id="sign_ajax"><img src="{STYLE_PATH_ADMIN}images/ajax-loader-small.gif" /> {lang.LOADING} ...</div>
<div id="sign_ajax_error" onclick="javascript:get_kleeja_link('./');"><img src="{STYLE_PATH_ADMIN}images/error.png" /> {lang.ERROR_AJAX}</div>

<!-- top right small icons -->
<div id="top_small_icons">
	<a href="{config.siteurl}" title="{lang.RETURN_HOME}">
		<img src="{STYLE_PATH_ADMIN}images/website.png" alt="{lang.RETURN_HOME}" />
	</a>
	<a href="./?cp=b_lgoutcp&amp;{GET_FORM_KEY_GLOBAL}" onclick="javascript:return confirm_from();" title="{lang.R_LGOUTCP}" >
		<img src="{STYLE_PATH_ADMIN}images/logout.png" alt="{lang.RETURN_HOME}" alt="{lang.R_LGOUTCP}"/>
	</a>

	<div class="clear"></div>
</div>

<div id="wrap">
	<!--  menu -->
	<div id="menu">
		<div id="MainMenuWrap" class="thumbnail">
			<div class="link_menu_thumbnail" id="menu_item1" gomenu_id="2" goto="index">
				<p><a class="seTooltip" title="{lang.R_CPINDEX}" href="./"  onclick="javascript:get_kleeja_link(this.href, '#content', {'current_id':'menu_item1', 'current_class':'link_current_thumbnail',gomenu_id:2}); return false;"><img src="{STYLE_PATH_ADMIN}images/menu/index_button.png" alt="{lang.R_CPINDEX}" style="margin:0 8px;vertical-align:middle;" /></a>
				</p>
			</div>
			<LOOP NAME="adm_extensions_menu">	
				<div class="({{current}}?link_current_thumbnail:) link_menu_thumbnail" id="menu_item{{i}}" gomenu_id="<EVEN="i">{{i}}<ELSE>{{i2}}</EVEN>" goto="{{goto}}">
					<p><a class="seTooltip" title="{{title}}" href="{{link}}" onclick="javascript:get_kleeja_link(this.href, '#content', {'current_id':'menu_item{{i}}', 'current_class':'link_current_thumbnail', 'gomenu_id':<EVEN="i">{{i}}<ELSE>{{i2}}</EVEN><IF LOOP="confirm">, confirm:true</IF>}); return false;"><img src="{{icon}}" alt="{{title}}" style="margin:0 8px;vertical-align:middle;" /></a> {{kbubble}}
					</p>
				</div>
				<!--  sub menu -->
				<EVEN="i">
				<div class="clear"></div>
				<ul class="go_menu" id="gomenu{{i}}"></ul>
				</EVEN>
			</LOOP>
		</div>

	</div>

	<div id="content">